import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class TestForArrayList extends list {


    void findElement(String findElenents) {
        if (list.contains(findElenents)) {
            System.out.print("I fond " + list.get(list.indexOf(findElenents)) + " index " + list.indexOf(findElenents));
        }
    }

    void removeElement(String removeElements) {
        if (list.contains(removeElements)) {
            list.remove(removeElements);
        }
    }

    void setElement(String setElements) {
        if (list.contains(setElements)) {
            list.set(list.indexOf(setElements), "don*t worry");
        }
    }

    ArrayList buildListFromLetterLess3() {
System.out.println("this info from ArrayList");
        ArrayList<String> listFromLetterLess3 = new ArrayList<String>();
        for (String element : list) {
            if (element.length() < 3) {
                listFromLetterLess3.add(list.get(list.indexOf(element)));
                //list.set(list.indexOf(element), "< 3");
            }
        }
        return listFromLetterLess3;

    }

    ArrayList buildListFromWordHaveGL() {

        ArrayList<String> listFromWordHaveGL = new ArrayList<String>();
        Pattern pattern = Pattern.compile("[аоэиуыеёюя]");
        for (String element : list) {
            Matcher matcher = pattern.matcher(element);
            if (matcher.find()) {
                listFromWordHaveGL.add(element);
            }
        }
        return listFromWordHaveGL;
    }
}
